{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "b9cce10d",
   "metadata": {},
   "source": [
    "------\n",
    "* Python Web crawler\n",
    "* 2023.10.18\n",
    "* week07:猎聘系统性抓取\n",
    "------"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "f7ba9c62",
   "metadata": {},
   "source": [
    "<!-- # 本周内容：\n",
    "##  构建数据抓取架构\n",
    "##  尝试建立重复抓取数据的体系 -->"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "8d5eac07",
   "metadata": {},
   "source": [
    "## 第一个Ajex的数据源请求\n",
    "> 1. 数据源是从chrome浏览器xhr中查询到的\n",
    "> 2. 尝试使用浏览器中requests header和payload\n",
    "> 3. 该数据基本描述：页面cardlist数据的源数据"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "4df154f1",
   "metadata": {},
   "source": [
    "## 第二个Ajex的数据源请求\n",
    "> 1. 数据源是从chrome浏览器xhr中查询到的\n",
    "> 2. 尝试使用浏览器中requests header和payload\n",
    "> 3. 该数据基本描述：页面cardlist数据的源数据"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "6dd1407b",
   "metadata": {},
   "source": [
    "# 请求数据准备"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "19ac8a7a",
   "metadata": {},
   "outputs": [
    {
     "ename": "ModuleNotFoundError",
     "evalue": "No module named 'liepindata'",
     "output_type": "error",
     "traceback": [
      "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[0;31mModuleNotFoundError\u001b[0m                       Traceback (most recent call last)",
      "Input \u001b[0;32mIn [9]\u001b[0m, in \u001b[0;36m<cell line: 2>\u001b[0;34m()\u001b[0m\n\u001b[1;32m      1\u001b[0m \u001b[38;5;66;03m# headers\u001b[39;00m\n\u001b[0;32m----> 2\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mliepindata\u001b[39;00m\n\u001b[1;32m      3\u001b[0m headers \u001b[38;5;241m=\u001b[39m liepindata\u001b[38;5;241m.\u001b[39mheaders()\n",
      "\u001b[0;31mModuleNotFoundError\u001b[0m: No module named 'liepindata'"
     ]
    }
   ],
   "source": [
    "# headers\n",
    "import liepindata\n",
    "headers = liepindata.headers()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "eb79fdad",
   "metadata": {},
   "outputs": [],
   "source": [
    "import json\n",
    "from request_html import HTML_Session\n",
    "r = session.post(\n",
    "            url = 'https://api-c.liepin.com/api/com.liepin.searchfront4c.pc-search-job',\n",
    "            data = json.dumps(payload), # POST请求带的参数\n",
    "            headers = liepin_headers  # 模拟真实用户\n",
    ")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "f1445bd6",
   "metadata": {},
   "source": [
    "# 指定数据抓取"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "62cf5cd0",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "87b82078",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.12"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
